//设为首页 <a οnclick="setHome(this,window.location)">设为首页</a>
function setHome(obj, vrl) {
    try {
        obj.style.behavior = 'url(#default#homepage)'; obj.setHomePage(vrl);
    }
    catch (e) {
        if (window.netscape) {
            try {
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
            }
            catch (e) {
                alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。");
            }
            var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
            prefs.setCharPref('browser.startup.homepage', vrl);
        }
    }
}
function addFavorite() {
    var url = window.location;
    var title = document.title;
    var ua = navigator.userAgent.toLowerCase();
    if (ua.indexOf("msie 8") > -1) {
        external.AddToFavoritesBar(url, title, '');//IE8
    } else {
        try {
            window.external.addFavorite(url, title);
        } catch (e) {
            try {
                window.sidebar.addPanel(title, url, "");//firefox
            } catch (e) {
                alert("加入收藏失败，请使用Ctrl+D进行添加");
            }
        }
    }
}

// 首页banner轮播
var swiper = new Swiper('.swiperShow', {
    slidesPerView: 1,
    loop: true,
    speed: 2500,
    autoplay: {
        delay: 3000,
        stopOnLastSlide: false,
        disableOnInteraction: false,
    },
    pagination: {
        el: '.swiper-pagination',
        clickable: true,
    },
    navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
    },
});

var swipe1 = new Swiper('.swiperSuccess', {
    slidesPerView: 5,
    // slidesPerGroup : 10,
    slidesPerColumn: 2,
    spaceBetween: 49,
    navigation: {
        nextEl: '.next1',
        prevEl: '.prev1',
    },
});
// 荣誉资质
var swiper2 = new Swiper('.swiperHonor', {
    slidesPerView: 4,
    // slidesPerGroup : 10,
    slidesPerColumn: 2,
    spaceBetween: 30,
    navigation: {
        nextEl: '.next2',
        prevEl: '.prev2',
    },
});
// 选项卡
$('.tab .menus li').each(function () {
    $('.tab .menus li').click(function () {
        $('.tab .menus li').removeClass('bg');
        $(this).addClass('bg');
        var index = $(this).index();
        $('.tab .scroll').css('margin-top', -index * 492 + 'px');
    })
})

$(document).ready(function (e) {
    $(".tabnews li").click(function () {
        $(".tabnews li").eq($(this).index()).addClass("active").siblings().removeClass("active");
        $(".tabCon>div").hide().eq($(this).index()).show();
    })
});

// 生成背景logo
var contLeft = parseInt($(".contLeft").width() / 176);
var contRight = parseInt($(".contRight").width() / 176);
var hSum = parseInt($(".container").height() / 126);
var sum1 = contLeft * hSum;
var sum2 = contRight * hSum;
console.log(sum1)
console.log(sum2)

for (i = 0; i <= sum1; i++) {
    $(".contLeft").append("<a href='javascript:void(0)'></a>");
}
for (i = 0; i <= sum2; i++) {
    $(".contRight").append("<a href='javascript:void(0)'></a>");
}